<?php
/**
 * PHP Framework Core Trace class
 * This class represents an object used for writing trace information
 *
 * @author Andrew <andrew@vitche.com>
 * @author Frozen Rain <frozenrain@mail.ru>
 **/
class Trace {

    private static $_items = array();

    public static function writeLine($format) {
        Trace::$_items[] = $format;
    }

    public static function flush() {
        if (count(Trace::$_items)) {
            $result = '<fieldset>';
            $result .= '<legend>Page Trace Stack</legend>';
            $result .= '<ul>';
            foreach (Trace::$_items as $key => $value) {
                $result .= "<li>" . serialize($value) . "</li>";
            }
            $result .= '</ul>';
            $result .= '</fieldset>';
            echo $result;
        }
    }
}
?>